﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace MediatR
{
    public class ForeachAwaitPublisherX : IRouteNotificationPublisher
    {
        public async Task Publish(IEnumerable<RouteNotificationHandlerExecutor> handlerExecutors, IRouteNotification notification, CancellationToken cancellationToken)
        {
            foreach (var handler in handlerExecutors)
            {
                await handler.HandlerCallback(notification, cancellationToken).ConfigureAwait(false);
            }
        }
    }
}
